import request from '@/utils/request'

/**
 * 新增区域
 * @param {Object} data
 * @returns
 */
export function addRoute(data) {
  return request({
    url: '/tissue/route/routeAdd',
    headers: { repeatSubmit: false },
    method: 'post',
    data
  })
}

/**
 * 修改区域
 * @param {Object} data
 * @returns
 */
export function updateRoute(data) {
  return request({
    url: '/tissue/route/updateRoute',
    method: 'post',
    data
  })
}

/**
 * 线路详情
 * @param {String} routeId
 * @returns
 */
export function getRouteDetail(routeId) {
  return request({
    url: '/tissue/route/routeDetail',
    method: 'get',
    params: { routeId }
  })
}

/**
 * 线路管理
 * @param {Object} params
 * @returns
 */
export function getRouteList(params) {
  return request({
    url: '/tissue/route/queryRoute',
    method: 'get',
    params
  })
}

/**
 * 禁、启用
 * @param {Object} params
 * @returns
 */
export function disableRoute(params) {
  params.enabled = params.enabled == '1' ? '0' : '1'

  return request({
    url: '/tissue/route/routeProhibit',
    method: 'get',
    params
  })
}
